<?php
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\DB;

use App\Models\Redf;
use App\Models\Reds;
use Excel;

class RedController extends Controller
{
    //发红包
    public function redf(){
    	$data = DB::table('redf')->orderBy('created_at', 'desc')->paginate(16);
    	return view('admin.red.redf',compact('data'));

    }

    //发红包排序
    public function redfp(){
      $data = DB::table('redf')->orderBy('price', 'desc')->paginate(16);
      return view('admin.red.redf',compact('data'));
    }

      //收红包
    public function reds(){
      $data = DB::table('reds')->orderBy('created_at', 'desc')->paginate(10);
      return view('admin.red.reds',compact('data'));

    }

    //发红包指定
    public function redft(Request $request){
      $data = DB::table('redf')->where('uid',$request->uid)->orderBy('created_at', 'desc')->paginate(10);
      return view('admin.red.redf',compact('data'));

    }

    //收红包指定
      public function redst(Request $request){
      $data = DB::table('reds')->where('openid',$request->openid)->orderBy('created_at', 'desc')->paginate(10);
      return view('admin.red.reds',compact('data'));

    }

    //收红包指定
      public function redstd(Request $request){
      $data = DB::table('reds')->where('fid',$request->fid)->orderBy('created_at', 'desc')->paginate(10);
      return view('admin.red.reds',compact('data'));
    }



}
